<template>
	<div class="user_center_wrapper wrapper">
		<div class="menu">
			<router-link to="/userCenter/userdata">
				<i class="el-icon-sw-user-data"></i>
				<span>个人资料</span>
			</router-link>
			<router-link to="/userCenter/resource">
				<i class="el-icon-sw-resource"></i>
				<span>我的资源</span>
			</router-link>
			<router-link to="/userCenter/schedule">
				<i class="el-icon-sw-schedule"></i>
				<span>我的课表</span>
			</router-link>
			<router-link to="/userCenter/collect">
				<i class="el-icon-sw-collect"></i>
				<span>我的收藏</span>
			</router-link>
		</div>
		<div class="main">
			<h2>{{ routerTitle }}</h2>
			<router-view />
		</div>
	</div>
</template>
<script>
export default {
	data() {
		return {
			routerTitle: ''
		};
	},
	watch: {
		$route: {
			handler(data) {
				this.routerTitle = data.meta.title || '个人资料';
			},
			immediate: true
		}
	}
};
</script>
<style lang="scss" scoped>
.user_center_wrapper {
	display: flex;
	align-items: flex-start;
	height: calc(100% - 20px);
	.menu {
		width: 200px;
		padding: 10px;
		flex-shrink: 0;
		margin-right: 24px;
		border-radius: 8px;
		background-color: #fff;
		a {
			display: flex;
			align-items: center;
			width: 100%;
			height: 44px;
			color: #333;
			line-height: 1;
			font-size: 16px;
			margin-top: 16px;
			padding: 10px 15px;
			border-radius: 8px;
			text-decoration: none;
			box-sizing: border-box;
			span {
				flex: 1;
			}
			&:first-child {
				margin-top: 0;
			}
			&.router-link-active {
				color: #fff;
				background-color: $mainColor;
				i {
					border-color: #fff;
				}
				&::after {
					font-family: 'element-icons';
					content: '\e6e9';
				}
			}
		}
		i {
			display: block;
			width: 24px;
			height: 24px;
			font-size: 20px;
			line-height: 24px;
			text-align: center;
			margin-right: 10px;
			box-sizing: border-box;
		}
	}
	.main {
		flex: 1;
		display: flex;
		flex-direction: column;
		min-height: 100%;
		border-radius: 8px;
		background-color: #fff;
		h2 {
			height: 24px;
			padding: 20px;
			font-size: 20px;
			line-height: 24px;
			font-weight: normal;
			border-bottom: solid 1px #ebeef5;
		}
	}
}
</style>
